package fr.unice.polytech.chord.core;

import java.io.Serializable;

/**
 * An entry represents a couple ({@link Key}, T) stored on the overlay.
 * 
 * @param <T>
 *            the type of the value associated to the Entry.
 * 
 * @author Anthony Parisy
 * @author Laurent Pellegrino
 * @author Marc Valdener
 * 
 * @version 10/28/2009
 */
@SuppressWarnings("serial")
public class Entry<T> implements Serializable {

	private Key key;

	private T value;

	/**
	 * Constructor.
	 * 
	 * @param key
	 *            the key to use.
	 * @param value
	 *            the value to use.
	 */
	public Entry(Key key, T value) {
		this.key = key;
		this.value = value;
	}

	/**
	 * Returns the key associated to this entry.
	 * 
	 * @return the key associated to this entry.
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * Returns the value associated to this entry.
	 * 
	 * @return the value associated to this entry.
	 */
	public T getValue() {
		return value;
	}

	/**
	 * {@inheritDoc}
	 */
	public String toString() {
		return this.value.toString();
	}

}
